﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DAO;
using DTO;
using DevExpress.XtraEditors.Repository;
using DevExpress.XtraEditors.Controls;
namespace CafeApp
{
    public partial class frmEmployees : DevExpress.XtraEditors.XtraForm
    {
        private List<DTO.DTO_Employees> listEmployess;
        public frmEmployees()
        {
            InitializeComponent();
            init();
        }
        private void init()
        {
            listEmployess = new List<DTO_Employees>();
        }
        private void loadListEmployees()
        {
            listEmployess = DAO_Employees.Select_All_Employees();
            gridNhanvien.DataSource = listEmployess;
        }
        private void load_full_form()
        {
            loadListEmployees();
        }
        private void frmEmployees_Load(object sender, EventArgs e)
        {
            load_full_form();
        }
        public List<DTO_Employees> getListEmployees()
        {
            return listEmployess;
        }

        private void UIButtonControler_Click(object sender, EventArgs e)
        {
            
        }

        private void UIButtonControler_ButtonClick(object sender, DevExpress.XtraBars.Docking2010.ButtonEventArgs e)
        {
            int index = e.Button.Properties.GroupIndex;
            switch(index)
            {
                case 0:// add new
                    {
                        MessageBox.Show(e.Button.Properties.Caption, "case 0 will be access");
                    }break;
                case 1:// delete
                    {
                        MessageBox.Show(e.Button.Properties.Caption, "case 1 will be access");
                    } break;
                case 2:// edit
                    {
                        MessageBox.Show(e.Button.Properties.Caption, "case 2 will be access");
                    } break;
                case 3:// cancel
                    {
                        MessageBox.Show(e.Button.Properties.Caption, "case 3 will be access");
                    } break;
                case 4:// done
                    {
                        MessageBox.Show(e.Button.Properties.Caption, "case 4 will be access");
                    } break;
            };
        }
    }
}